unit gui_form_Tiatai_main;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

type

  { TTTiatai_MainForm }

  TTTiatai_MainForm = class(TForm)
    AISettingsBtn: TButton;
    ResourceBtn: TButton;
    OutputBtn: TButton;
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    PlayFieldBtn: TButton;
    procedure AISettingsBtnClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure OutputBtnClick(Sender: TObject);
    procedure PlayFieldBtnClick(Sender: TObject);
    procedure ResourcesBtnClick(Sender: TObject);
  private
    FClosed: boolean;
    FOnAISettingsClick: TNotifyEvent;
    FOnFieldClick: TNotifyEvent;
    FOnOutputClick: TNotifyEvent;
    FOnResourcesClick: TNotifyEvent;
    procedure SetOnAISettingsClick(AValue: TNotifyEvent);
    procedure SetOnFieldClick(AValue: TNotifyEvent);
    procedure SetOnOutputClick(AValue: TNotifyEvent);
    procedure SetOnResourcesClick(AValue: TNotifyEvent);
    { private declarations }
  public
    property Closed: boolean read FClosed write FClosed;
    { public declarations }
    property OnFieldClick: TNotifyEvent read FOnFieldClick write SetOnFieldClick;
    property OnAISettingsClick: TNotifyEvent read FOnAISettingsClick write SetOnAISettingsClick;
    property OnOutputClick: TNotifyEvent read FOnOutputClick write SetOnOutputClick;
    property OnResourcesClick: TNotifyEvent read FOnResourcesClick write SetOnResourcesClick;
  end;

implementation

{$R *.lfm}

{ TTTiatai_MainForm }

procedure TTTiatai_MainForm.FormClose(Sender: TObject;
  var CloseAction: TCloseAction);
begin
  FClosed := true;
end;

procedure TTTiatai_MainForm.AISettingsBtnClick(Sender: TObject);
begin
  if assigned(FOnAISettingsClick) then FOnAISettingsClick(self);
end;

procedure TTTiatai_MainForm.FormCreate(Sender: TObject);
begin
  FClosed := false;
end;

procedure TTTiatai_MainForm.OutputBtnClick(Sender: TObject);
begin
  if assigned(FOnOutputClick) then FOnOutputClick(self);
end;

procedure TTTiatai_MainForm.PlayFieldBtnClick(Sender: TObject);
begin
  if assigned(FOnFieldClick) then FOnFieldClick(self);
end;

procedure TTTiatai_MainForm.ResourcesBtnClick(Sender: TObject);
begin
  if assigned(FOnResourcesClick) then FOnResourcesClick(self);
end;

procedure TTTiatai_MainForm.SetOnFieldClick(AValue: TNotifyEvent);
begin
  if FOnFieldClick=AValue then Exit;
  FOnFieldClick:=AValue;
end;

procedure TTTiatai_MainForm.SetOnOutputClick(AValue: TNotifyEvent);
begin
  if FOnOutputClick=AValue then Exit;
  FOnOutputClick:=AValue;
end;

procedure TTTiatai_MainForm.SetOnResourcesClick(AValue: TNotifyEvent);
begin
  if FOnResourcesClick=AValue then Exit;
  FOnResourcesClick:=AValue;
end;

procedure TTTiatai_MainForm.SetOnAISettingsClick(AValue: TNotifyEvent);
begin
  if FOnAISettingsClick=AValue then Exit;
  FOnAISettingsClick:=AValue;
end;

end.

